// ElaStatusBarTest.h
#ifndef ELASTATUSBARTEST_H
#define ELASTATUSBARTEST_H

#include "ElaStatusBar.h"
#include "ElaWidgetTools/ElaIconButton.h"
#include "ElaWidgetTools/ElaProgressBar.h"
#include "ElaText.h"
#include <QWidget>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QLabel>
#include <QTimer>
#include <QProgressBar>

class ElaStatusBarTest : public QWidget
{
    Q_OBJECT

  public:
    explicit ElaStatusBarTest(QWidget* parent = nullptr);
    ~ElaStatusBarTest();

    // 获取状态栏实例，方便外部访问
    ElaStatusBar* statusBar() const
    {
        return m_statusBar;
    }

    void updateThemeIndicator();

  private Q_SLOTS:
    void toggleConnectionStatus();
    void updateProgress();
    void toggleThemeIndicator();
    void showCustomMessage();
    void clearCustomMessage();

  private:
    void setupStatusBar();
    void createConnectionStatusItem();
    void createBatteryStatusItem();
    void createMemoryUsageItem();
    void createThemeIndicatorItem();
    void createCustomMessageArea();

  private:
    ElaStatusBar* m_statusBar;

    // 状态栏项目
    QWidget* m_connectionContainer;
    ElaIconButton* m_connectionIcon;
    QLabel* m_connectionText;

    QWidget* m_batteryContainer;
    ElaIconButton* m_batteryIcon;
    QLabel* m_batteryText;

    QWidget* m_memoryContainer;
    ElaProgressBar* m_memoryProgress;
    QLabel* m_memoryText;

    QWidget* m_themeContainer;
    ElaIconButton* m_themeIcon;

    QLabel* m_customMessage;

    // 状态变量
    bool m_isConnected;
    int m_batteryLevel;
    int m_progressValue;
    bool m_isLightTheme;

    QTimer* m_progressTimer;
};

#endif  // ELASTATUSBARTEST_H